import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '任务ID',
    align:"center",
    dataIndex: 'wmTaskId'
   },
   {
    title: '仓库ID',
    align:"center",
    dataIndex: 'warehouseId'
   },
   {
    title: '出库数量',
    align:"center",
    dataIndex: 'completeQuantity'
   },
   {
    title: '剩余数量',
    align:"center",
    dataIndex: 'remainQuantity'
   },
   {
    title: '物流编号',
    align:"center",
    dataIndex: 'logisticsNo'
   },
   {
    title: '物流公司',
    align:"center",
    dataIndex: 'logisticsCompany'
   },
   {
    title: '唛头号',
    align:"center",
    dataIndex: 'marksNo'
   },
   {
    title: '附件照片地址',
    align:"center",
    dataIndex: 'file',
    customRender:render.renderImage,
   },
   {
    title: '发货人',
    align:"center",
    dataIndex: 'sendBy'
   },
   {
    title: '发货时间',
    align:"center",
    dataIndex: 'sendTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '到货时间',
    align:"center",
    dataIndex: 'arriveTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '任务ID',
    field: 'wmTaskId',
    component: 'Input',
  },
  {
    label: '仓库ID',
    field: 'warehouseId',
    component: 'Input',
  },
  {
    label: '出库数量',
    field: 'completeQuantity',
    component: 'InputNumber',
  },
  {
    label: '剩余数量',
    field: 'remainQuantity',
    component: 'InputNumber',
  },
  {
    label: '物流编号',
    field: 'logisticsNo',
    component: 'Input',
  },
  {
    label: '物流公司',
    field: 'logisticsCompany',
    component: 'Input',
  },
  {
    label: '唛头号',
    field: 'marksNo',
    component: 'Input',
  },
  {
    label: '附件照片地址',
    field: 'file',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 0
      },
  },
  {
    label: '发货人',
    field: 'sendBy',
    component: 'Input',
  },
  {
    label: '发货时间',
    field: 'sendTime',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD'
    },
  },
  {
    label: '到货时间',
    field: 'arriveTime',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD'
    },
  },
  {
    label: '状态',
    field: 'status',
    defaultValue: "PREPARE",
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"product_sale_status"
     },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  wmTaskId: {title: '任务ID',order: 0,view: 'text', type: 'string',},
  warehouseId: {title: '仓库ID',order: 1,view: 'text', type: 'string',},
  completeQuantity: {title: '出库数量',order: 2,view: 'number', type: 'number',},
  remainQuantity: {title: '剩余数量',order: 3,view: 'number', type: 'number',},
  logisticsNo: {title: '物流编号',order: 4,view: 'text', type: 'string',},
  logisticsCompany: {title: '物流公司',order: 5,view: 'text', type: 'string',},
  marksNo: {title: '唛头号',order: 6,view: 'text', type: 'string',},
  file: {title: '附件照片地址',order: 7,view: 'image', type: 'string',},
  sendBy: {title: '发货人',order: 8,view: 'text', type: 'string',},
  sendTime: {title: '发货时间',order: 9,view: 'date', type: 'string',},
  arriveTime: {title: '到货时间',order: 10,view: 'date', type: 'string',},
  status: {title: '状态',order: 11,view: 'list', type: 'string',dictCode: 'product_sale_status',},
  remark: {title: '备注',order: 12,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}